package com.lihepeng.leecode.mulitithread;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolTest {
    public static void main(String[] args) {
        RejectedExecutionHandler handler = new MyIgnorePolicy();
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5,5,10, TimeUnit.SECONDS,new LinkedBlockingQueue(10),new ThreadPoolExecutor.CallerRunsPolicy());
        for (int i=0;i<10000;i++){
            threadPoolExecutor.execute(new RunTask());
        }
        threadPoolExecutor.shutdown();
    }
}
